package com.toplabs.unashu.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.toplabs.unashu.annotation.CreateTime;
import com.toplabs.unashu.annotation.UpdateTime;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 博客实体类
 * </p>
 *
 * @author ityanger
 * @since 2020-08-23
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
public class Blog implements Serializable {

    private static final long serialVersionUID = 1L;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    private String title; // 标题

    private String content; // 内容

    private String render; // 渲染

    private String firstPicture; // 首图

    private String flag; // 标记 原创/转载/翻译

    private boolean status; // 状态  发布/草稿

    private Integer views; // 浏览次数

    private boolean appreciation = true; // 赞赏开启

    private boolean shareStatement = true; // 版权开启

    private boolean commentable = true; // 评论开启

    private String published; // 发布: 公开/私密

    private boolean recommend; // 推荐

    @CreateTime
    private Date createTime; // 创建时间

    @UpdateTime
    private Date updateTime; // 更新时间

    private String description; // 摘要

    private List<Type> types = new ArrayList<>();

    private String typeIds;

    private User user;

    @JsonSerialize(using = ToStringSerializer.class)
    private Long userId;

    private String tagNames;

    private List<String> tags = new ArrayList<>();

    private List<Comment> comments = new ArrayList<>();

}
